package day18.Junit_reflect_annotation_proxy.reflectdemo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

public class demo1
{
    public static void main(String[] args) throws ClassNotFoundException {

        //获取某个类的。class对象。这个对象（class）指向了这个类，类型是Class类型
             Class c1=Student.class;//c1指向了Student类，那不就相当于获取这个类本身了
             System.out.println(c1.getName());


                 //获取指向这个类的对象  Class.forName(String classPath)
                 Class c2=Class.forName("day18.Junit_reflect_annotation_proxy.reflectdemo.demo1$Student");
                 System.out.println(c2.getName());

                  //通过实例化的对象来获取指向这个类的class对象
                 Student s=new Student("张三", 18);
                 Class c3=s.getClass();

                 System.out.println(c1==c2);
                 System.out.println(c2==c3);

    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Student
    {
        private String name;
        private int age;
        public void run()
        {

        }
    }
}
